﻿using System;
using __ts.Core.Api;

/*
 *  author: able
 *  @2012/2/21 17:29:40
 * 
 */
namespace __ts.Core.Transport.Tcp
{
    /// <summary>
    /// 
    /// </summary>
    public interface SocketSessionConfig : IoSessionConfig
    {
        /**
     * @see Socket#getTcpNoDelay()
     */
        Boolean isTcpNoDelay();

        /**
         * @see Socket#setTcpNoDelay(bool)
         */
        void setTcpNoDelay(bool tcpNoDelay);

        /**
         * @see Socket#getReuseAddress()
         * return <code>null</code> if the default system value is used 
         */
        Boolean isReuseAddress();

        /**
         * @see Socket#setReuseAddress(bool)
         */
        void setReuseAddress(bool reuseAddress);

        /**
         * @see Socket#getReceiveBufferSize() 
         * return <code>null</code> if the default system value is used
         */
        int getReceiveBufferSize();

        /**
         * @see Socket#setReceiveBufferSize(int)
         */
        void setReceiveBufferSize(int receiveBufferSize);

        /**
         * @see Socket#getSendBufferSize() 
         * return <code>null</code> if the default system value is used
         */
        int getSendBufferSize();

        /**
         * @see Socket#setSendBufferSize(int)
         */
        void setSendBufferSize(int sendBufferSize);

        /**
         * @see Socket#getTrafficClass()
         * return <code>null</code> if the default system value is used
         */
        int getTrafficClass();

        /**
         * @see Socket#setTrafficClass(int) 
         */
        void setTrafficClass(int trafficClass);

        /**
         * @see Socket#getKeepAlive() 
         * return <code>null</code> if the default system value is used
         */
        Boolean isKeepAlive();

        /**
         * @see Socket#setKeepAlive(bool) 
         */
        void setKeepAlive(bool keepAlive);

        /**
         * @see Socket#getOOBInline() 
         * return <code>null</code> if the default system value is used
         */
        Boolean isOobInline();

        /**
         * @see Socket#setOOBInline(bool) 
         */
        void setOobInline(bool oobInline);

        /**
         * Please note that enabling <tt>SO_LINGER</tt> in Java NIO can result
         * in platform-dependent behavior and unexpected blocking of I/O thread.
         *
         * @see Socket#getSoLinger()
         * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179351">Sun Bug Database</a>
         * return <code>null</code> if the default system value is used
         */
        int getSoLinger();

        /**
         * Please note that enabling <tt>SO_LINGER</tt> in Java NIO can result
         * in platform-dependent behavior and unexpected blocking of I/O thread.
         *
         * @param soLinger Please specify a negative value to disable <tt>SO_LINGER</tt>.
         *
         * @see Socket#setSoLinger(bool, int)
         * @see <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6179351">Sun Bug Database</a>
         */
        void setSoLinger(int soLinger);
    }
}